package com.nhncorp.pleiades.msg;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class NeptuneMessageParser implements MessageParser {
  
  public static final Log LOG = LogFactory
  .getLog(NeptuneMessageParser.class.getName());
  
  public NeptuneMessageParser() {
  }

  public boolean isValidMessage(Object message) {
    boolean isSuccess = false;
    if (((NeptuneMessage) message).getMessageType() == NeptuneMessageType.TYPE.TABLET_FAIL
        .ordinal()) {
      isSuccess = true;
    } else if (((NeptuneMessage) message).getMessageType() == NeptuneMessageType.TYPE.TABLET_CREATED
        .ordinal()) {
      isSuccess = true;
    } else if (((NeptuneMessage) message).getMessageType() == NeptuneMessageType.TYPE.TABLET_ALIVE
        .ordinal()) {
      isSuccess = true;
    } else if (((NeptuneMessage) message).getMessageType() == NeptuneMessageType.TYPE.TABLET_ASSIGN
        .ordinal()) {
      isSuccess = true;
    } else if (((NeptuneMessage) message).getMessageType() == NeptuneMessageType.TYPE.TABLET_AVAIL
        .ordinal()) {
      isSuccess = true;
    } else {
      LOG.debug("message format is wrong");
    }
    return isSuccess;
  }

}
